I have added increment counter in wear module and trying to pass the incremented value to the mobile module. Even though , I receive "successfully sent" response from the wear module(through google API sendmessage() called inside a service), the message is not being received by Listener service(extends Wearable listenerService) in the mobile module.I have added following intent filters for the mobile listener service,
<service android:name=".ListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<action android:name="com.google.android.gms.wearable.CAPABILITY_CHANGED" />
<action android:name="com.google.android.gms.wearable.CHANNEL_EVENT" />
<data android:scheme="wear" android:host="*" android:pathPrefix="/prefix" />
</intent-filter>
</service>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I am incrementing count everytime and but still no response,Everything is fine till it is dispatched from the wearable.Any suggestions would be great.
The following things I have verified,
Both of the modules package names and application Ids are identical.
I am running the wear app on emulator hence, verified that
emulatore is already connected to mobile through Android wear app.
Able to send notifications from mobile to wear app.
Made sure count in wear app is changing everytime I send it to
mobile app.
No signing key difference possiblity as I both the modules are run
as debug builds.
Made sure both the URI paths are same for shared data(count).
Related
Am working with two apps, In A App on clicking button, i hit the playstore link of B App and send data in playstore url and when app is installed, i get parameters from "referrel"
I used InstallReferrelReciever in manifest of B app as like:
<receiver android:name=".data.AppInstallReceiver"
android:permission="android.permission.INSTALL_PACKAGES"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
so here i get issue on some devices like Redmi and Oppo InstallReferrelReceiver is not called sometime but that works fine on Samsung devices.
I have successfully implemented communication between my phone and watch app through WearableListenerServices in both modules. This works perfectly for the most part, however, if i don't use the phone app in a while the watch app stops communicating. This suggests the WearableListenerService is not "woken" up as expected. To fix this, I have to open the phone app and for the next while the watch app communicates perfectly again.
Is there a way I can guarantee that it will be "woken" up? Or am I missing something?
Phone manifest:
<service android:name=".app.util.ListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<data
android:host="*"
android:scheme="wear" />
</intent-filter>
</service>
Wear app:
<service android:name=".util.ListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<data
android:host="*"
android:scheme="wear" />
</intent-filter>
</service>
If you need more on the specific implementation of the listeners I'm happy to provide it, but it doesn't seem relevant. Thanks!
We all knew that the BIND_LISTENER for wearable app is already deprecated and it is replaced by a fine-grained intent filter. So make sure that you use a correct filters for your app. You can know the meaning and purpose of individual filters here.
Try to check this documentation for Building Apps for Wearables, it shows you how to use the WearableListenerService for your app. It also provide some sample code that you can verify if you properly implemented this code in your application.
I have a simple Android app that does not do anything special except receiving and showing GCM notifications and - then - opening the browser (when a notification is clicked on).
GCM is configured newely as described in the current documentation. The browser is based on the class WebViewClient.
I have noticed that this app consumes 4 or 5 times more battery as any other app installed on my phone. As far as I can understand the BroadcastReceiver is always running which can cause such an extremely high battery usage.
Is there any may to reduce it? Sometimes my smartphone gets really hot without any activity from my side.
The fragment of my Manifest about GCM:
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:persistent="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="my.package" />
<category android:name="my.package" />
</intent-filter>
</receiver>
Thank you in advance.
Probably the best that you can do is to implement GCM (Google Cloud Messaging) using pushing instead of polling.
In this way you will be able to get a "tickle" when something new happened and you will know when ask to the server for datas.
I've created a very basic app that has an intent for external NDEF type as shown below.
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="vnd.android.nfc"
android:host="ext"
android:pathPrefix="/com.example:externalType"/>
</intent-filter>
The activity the above is nested in is the main activity for the app and is just a vanilla blank activity.
All works fine on the standard user side however if I side load the app on to the Work Profile the intent never reaches the app and the "New tag collected" screen is shown.
The Android documentation states that the Profile administrator can control which intents are sent across from the user to the work profile however I can find no such settings within the BlackBerry Enterprise Server 12 (our MDM) console or the Android for Work console.
http://developer.android.com/training/enterprise/app-compatibility.html#prevent_failed_intents
I have a pro key application package for my application, and I would like to set up a BroadcastReceiver to receive intents when the pro key package is added or updated. Here's my code:
<receiver android:name=".Receiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<data android:scheme="package" android:path="com.test.key"/>
</intent-filter>
</receiver>
The code starts up the receiver on every app I install or update the com.test.key app, but it fires for every other apps as well. How can I listen for package updates for com.test.key only?
I know how to do it in the Receiver.java (intent.getData().getSchemeSpecificPart()). I'm looking for a way to do the filtering in the Android Manifest, so the broadcast doesn't get fired every time user installs an app.