Track Applications on Android - java

is it possible to keep track of install/uninstall actions of Applications on the Android system? I was not able to find a proper Intent Action or Broadcast event so far.
What I'm searching for an observer for applications like there are observers for Calendar or CallLog changes. Does there exists an CONTENT_URI or Broadcast event?
Regards

You can create a broadcast receiver for package install and unistall.
<receiver android:name=".YourReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_INSTALL" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package"/>
</intent-filter>
</receiver>
For More info go to link

Related

App not receiving boot completed intent in some devices

i created an app that always start a service once the device has completed booting.
This is the Manifest code..
<receiver>
android:name="StartMyServiceAtBootReceiver"
android:directBootAware ="true"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<action android:name="android.intent.action.REBOOT"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
The service always start in some devices once boot is completed but in my own device which is running android 7.0, the boot completed service doesn't start unless i convert the app to system app using root access. Can someone tell me how to make the app to start the service on boot completed without converting it to a system app?
First of All
receiver android:name="StartMyServiceAtBootReceiver"
Your path to Receiver should written over here for example:
<receiver android:name=".receiver.BootReceiver">
first dot suggest your path till root of the package.
Create a BroadcastReceiver and register it to receive ACTION_BOOT_COMPLETED. You also need RECEIVE_BOOT_COMPLETED permission.
Read: Listening For and Broadcasting Global Messages , and Setting Alarms
Try into manifest
<receiver
android:name=".AutoStart"
android:enabled="true"
android:exported="true" >
<intent-filter android:priority="500" >
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Make sure also to include the completed boot permission.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
Also read this answer carefully

Parse.com Push Notification not working

I am not able to receive push notifications at all. onPushReceieved method in my receiver class is never called.
Here's what my manifest looks like:
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.compName.appName.permission.C2D_MESSAGE" />
<uses-permission android:name="com.compName.appName.permission.C2D_MESSAGE" />
<application>
.
.
<service android:name="com.parse.PushService" />
<receiver android:name="com.compName.appName.helpers.MyParsePushReciever"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
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" />
<category android:name="com.compName.appName" />
</intent-filter>
</receiver>
</application
This is the init methods for Parse in my Applications onCreate Method:
Parse.initialize(this, app_id, client_id);
PushService.startServiceIfRequired(this);
ParseInstallation.getCurrentInstallation().saveInBackground();
Here is my Receiver class's onPushReceived method:
#Override
protected void onPushReceive(Context context, Intent intent) {
Log.i("hereeeeeeeeee === ", "on push recieve");
}
I am never able to see that Log. OnPushReceive never gets called. Is there something I am missing?
Check your manifest and gradle file, I think the package names are wrong.
I heard about parse.com is going to be off forever
and yes its down officially.
http://parse.com/
EDIT
As parse announced their shutdown recently, GCM is the only best option though it won’t comes with an admin interface.
You can follow this awesome tutorial for this.
http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat-app-part-1/
I figured it out.
I had changed my package a long time ago. I had made changes to my manifest, but not in my gradle file.
Shout out to Taylor Courtney for continuing in helping me figure it out. He's the real MVP.

Handle network configuration sms

I want to handle received sms that contains network configurations(OMA OTA). I have already developed android application that catches typical sms from inbox. Network configuration is not a typical sms. How can I get it? What is a Broadcast Action for that?
I was trying this:
<receiver android:name="ru.tenet.pdureceiver.SMSReceiver" >
<intent-filter android:priority="1" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
As I understood, android.provider.Telephony.SMS_RECEIVED is not enough.
Well, I've found a solution. The action is:
android.provider.Telephony.WAP_PUSH_RECEIVED
And also there must be a mimeType defined for wap message.
For example:
<intent-filter android:priority="1" >
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
<data android:mimeType="application/vnd.wap.connectivity-wbxml" />
</intent-filter>

Add flags to incoming broadcasts

I need to listen for Install, Updates and Remove broadcasts via a BroadcastReceivers, here is the definition:
<receiver android:name=".InstallReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package"/>
</intent-filter>
</receiver>
Now, Is it possible to add Intent.FLAG_RECEIVER_FOREGROUND flags to these incoming intents? because in android KitKat receivers affect to foreground services due to bug which reported here.
Any ideas on how to add this flag to incoming broadcasts?
While you are welcome to call addFlags() on the Intent, it will not have any effect. Only the flags added by the broadcaster matter, and you are not the broadcaster.

Android unregisterReceiver with onPause

I have something like this in my manifest file - I need one receiver for the situation that a power source was connected and the other receiver for unplugged source.
<receiver android:name=".PowerConnectionOnReceiver" >
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
</intent-filter>
</receiver>
<receiver android:name=".PowerConnectionOffReceiver" >
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
But I want to unregisterReceiver, when onPause is called in my MainActivity. How to do it?
If your broadcast receiver is specified in the manifest, it cannot be unregistered programmatically. You will need to take it out of the manifest and register it from within your code.
You cannot unregister these receivers because they are defined in manifest, not in code. Receivers which are defined programmatically are the one which may get unregistered.

Categories

Resources