[Q] Problems with modifying google example app BluetoothChat - Android Q&A, Help & Troubleshooting

Hello together,
at the moment I'm developing a application based on googles example BluetoothChat (to find on googles developing site or within the examples in the android sdk)
I've modified the application so that every entry in the list view can be clicked and within a click a new activity starts (because I want to display some details). My Problem now is that this activity should have the same title like the main activity (BluetoothChat). This activity shows the connection status in the title and gets this information from the BluetoothChatService. How can I get to this information in my new activity?
thx

Related

[Q] Android Notepad Tutorial - Implementing Search feature

I have been learning Android programming from various books and tutorials from roughly 4-5 months now and have a basic idea of most of the things in Android Programming and I recently started with the Notepad Tutorial and now have the final application after Exercise 3.
I want to add the search feature to my app. So that the notes that are stored in the database can be searched i.e. a word given as search query is checked in the body section of all the notes and then only those notes are listed which contain that specific word.
Please can you suggest some modifications in the existing code or suggest what will be needed to implement this search feature? How can the SQLite query be modified for this? or should I use indexof() method of Java after storing the body of all the notes in a String Array? and then just displaying those elements of the array using the for loop and if condition with the indexof() method??

[Q] How to return back to previous activity ?

I am new to Android development, hence kindly forgive any unintentional mistakes, if made.
I have a native activity rendering using ES2.0. The app needs to start twitter authentication (it uses twitter4j).
I am starting a new activity with twitter auth url. It shows the login page. I give userId, password, the native browser says now it would be redirected to the previous page or something. Then I see a black screen which apparently is the default browser still on top of the application. If I go to home, and background processes, I see my app and the browser as separate activities which makes sense.
Now my question is , how do I code my app to return back to the application once the authentication ends?
Here is the code flow to start the new activity
1. Native code calls JNI function to start authorization
2. The Java function creates an AsyncTask, in doInBackground() it gets the request token using getOAuthRequestToken(URL) where URL = custom url "app1://callback".
3. in onPostExecute() , app starts new intent activity using this code
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL()));
BaseGameActivity.startActivity(intent);
Log.debug("authenticate task post ends");

"Sign-in to network" panel not fully functional for Web browsing

Not sure if I’m on-topic here or not, but here goes... I am responsible for the setup/configuration of WiFi routers in various restaurants and venues. We are simply using the built-in splash page functionality of the router to, upon connection, present a simple marketing message and daily special offer via an extremely simple, static external HTML page, rather than the login page that many venues present (airports, coffee shops, McDonalds, etc.).
After connecting to our SSID with a PC or mobile device, users are presented with a customized splash page where our venue’s latest “offer of the day” banner ad is presented, which links via a standard hyperlink out to a PDF coupon for them to redeem said offer. There are also a couple of other simple items on the page, such as a menu with links to other offers, and an embedded Google Map to the venue in question.
All seems to be OK on PCs and iPad/iPhone devices. However, we are running into a problem on Android devices – specifically, Android devices using newer/more recent versions of the Android OS.
The problem is that Google has made a change to newer versions of Android so that WiFi connection login/splash/confirmation pages no longer come up in the default Web browser of the phone/tablet in question. Instead, they seem to come up in some kind of built-in notification window simply titled “Sign-in to network” – it does not seem to be a full-blown, feature-compliant browser, but rather a panel of sorts built into Android. And when our basic, mainly static HTML page loads within this alert window, none of the standard HTML features (such as hyperlinks) seem to work. A window appears with the title “Sign-in to network”, and our splash page appears on within it, but the standard HTML hyperlink from our special offer graphic (to a PDF file) does not work. Clicking it has no effect. Our menu underneath that does not seem to open (it’s automatically collapsed on mobile devices), and none of the links within it work properly, and our embedded Google Map does not appear at all. It’s as if this alert window or whatever we call it does not support the basic features of HTML pages in any way.
There appears to be no way for me to programmatically force the Android client to “escape” from this proprietary panel and open up a page in their default browser. I’ve tried placing various forms of client and server side “push/redirect” code on the page in an effort to escape from this alert window and cue the default browser to open, with no luck. No matter what I do, it seems that they Android phones always load the splash page within a “sign-in to network” notification page rather than a browser, and that this notification panel is not fully functional for even basic HTML features such as <a> hyperlinks, javascript, or embedded items.
It’s possible that Android’s proprietary “sign-in to network” panel is apparently seeking some sort of acknowledgement of a successful "login" in order to proceed with any subsequent browsing. But if so, I don’t know what constitutes “acknowledgement”. Perhaps there some way to force a hidden form submission or link click programmatically to force the Android device to accept/acknowledge the connection just as if the user had logged in normally, so that we can then proceed to subsequent Web browsing?
Has anyone experienced this problem, or have any ideas as to whether there’s a work-around or coding-based solution to this difficulty?
Thanks very much for your help in advance.
UPDATE: I've been in touch with the Google developers of the sign-in panel... they indicated that "captive portal sign-in pages are displayed in an Android WebView, which uses much of the same code as the Chrome browser. The sign-in app is very simple, you can see all of its source code here.
One second after each navigation (including the initial page load), the app probes to see if the user has successfully signed into the network. This probe is done by fetching a URL that should give back a 204 response."
Based on this, I am making the assumption that until captive portal sign-in app probes to see if the user is successfully signed in, all other navigation and many other features on the page are disabled, and that the full functionality of the WebView panel is restored after a successful sign-in to the network. But if so how can I successfully "signal" to the sign-in app that the user is, in fact, signed in (or rather, that no sign is in necessary or desired)? Is there something programmatically that I can do in the page code to ensure this, so that the viewer can then proceed to normal Web navigation within the panel, and so forth?
Any insight into how this works from anyone here would be greatly appreciated!
Thanks!

Android activity log

Hi all,
i am new to Android, and i am trying to find out if an android keeps a log of the when applications were open or used.
e.g. I open Gmail, then Calendar, and I would be able to see on the log what time the app was accessed, or at least last used (which i thinks some versions of Android can do on some mobile models, but not all.
Depending on the mobile brand and model you can check open application, but that is not display in a shape of log.
Is this log exist where can it be found please?
Thank you

Retrieving context of application (browsing, youtube etc.)

Hello
In Android it is easy to get the application or package name of the current foreground application. Is it also possible to get the context of the foreground application (i.e. for youtube application what video is played and for browsing what webpage is browsed and so on)? It should run on non-rooted phones. Is it perhaps possible with an accessibility service?

Categories

Resources