It seems like the \"old\" code from the existing APK is executed (its application's onCreate() is invoked) trying to access the \"new\" manifest that exists in the updated APK and can't find the \"old\" receiver (is this even possible?).
[UPDATED] Android SetComponentEnabledSetting
Logistically, this might require you to produce an interim version of your app (that added the setComponentEnabledSetting() call before installPackage() and should still have \"SomeOldReceiver\" in its manifest) to update the old version first. You can then update this version to your real updated version with \"SomeOldReceiver\" removed.
The android.intent.action.MAIN action (which usually exists on your default activity) tells Android which activity should be used to start your app. However, we can define multiple aliases for our single activity, with the end result of multiple configurations of icon + title for our app.
One thing this malware does not do and could be easily achieved is persistence. Through a Broadcast Receiver and the use of the android.permission.RECEIVE_BOOT_COMPLETED permission we could execute our desired code when the device reboots.
06-17 16:13:18.075: ERROR/AndroidRuntime(2026): Caused by:java.lang.SecurityException: Permission Denial: attempt to change componentstate from pid=2026, uid=10004, package uid=1003206-17 16:13:18.075: ERROR/AndroidRuntime(2026): atandroid.os.Parcel.readException(Parcel.java:1234)06-17 16:13:18.075: ERROR/AndroidRuntime(2026): atandroid.os.Parcel.readException(Parcel.java:1222)06-17 16:13:18.075: ERROR/AndroidRuntime(2026): atandroid.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:1823)06-17 16:13:18.075: ERROR/AndroidRuntime(2026): atandroid.app.ApplicationContext$ApplicationPackageManager.setComponentEnabledSetting(ApplicationContext.java:2421)
NotificationService: No Channel found for pkg=com.game.name, channelId=null, id=-1217830295, tag=null, opPkg=com.game.name, callingUid=10473, userId=0, incomingUserId=0, notificationUid=10473, notification=Notification(channel=null pri=0 contentView=null vibrate=default sound=android.resource://com.game.name/2131099649 tick defaults=0x6 flags=0x11 color=0x00000000 vis=PUBLIC)
Thanks, for any testing you can reply me.Onesignal Example : -Android-SDKSo i tried default Onesignal android studio example with Android-8.1 and its working fine, so may be you can cross check with that.
Broadcast receiverWe are going to use AlarmManager to set the repeating alarm which eventually sends the intent at the specific time interval. Read this post to know more about the AlarmManager.Now create AlarmManagerBroadcastReceiver class to extend the BroadcastReceiver class. The content of the class is given below.package com.code4reference.enabledisablebroadcastreceiver;import java.text.Format;import java.text.SimpleDateFormat;import java.util.Date;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.os.PowerManager;import android.widget.Toast;public class AlarmManagerBroadcastReceiver extends BroadcastReceiver final public static String ONE_TIME = 'onetime'; @Override public void onReceive(Context context, Intent intent) //You can do the processing here update the widget/remote views. StringBuilder msgStr = new StringBuilder(); //Format time. Format formatter = new SimpleDateFormat('hh:mm:ss a'); msgStr.append(formatter.format(new Date())); Toast.makeText(context, msgStr, Toast.LENGTH_SHORT).show(); Enable/Disable Broadcast receiverNow we will define main activity which uses alarmManager to set a repeating alarm. The repeating alarm will broadcast intent after every 3 seconds. This alarm has been set in the setRepeatingAlarm() method below.package com.code4reference.enabledisablebroadcastreceiver;import com.example.enabledisablebroadcastreceiver.R;import android.app.Activity;import android.app.AlarmManager;import android.app.PendingIntent;import android.content.ComponentName;import android.content.Context;import android.content.Intent;import android.content.pm.PackageManager;import android.os.Bundle;import android.view.View;import android.widget.Toast;public class EnableDisableBroadcastReceiver extends Activity @Override public void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /** * This method gets called when 'Start Repeating Alarm' button is pressed. * It sets the repeating alarm whose periodicity is 3 seconds. * @param view */ public void startRepeatingAlarm(View view) AlarmManager am=(AlarmManager)this.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, AlarmManagerBroadcastReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(this, 0, intent, 0); //After after 2 seconds am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 1000 * 4 , pi); Toast.makeText(this, 'Started Repeating Alarm', Toast.LENGTH_SHORT).show(); /** * This method gets called when 'cancel Alarm' button is pressed. * This method cancels the previously set repeating alarm. * @param view */ public void cancelAlarm(View view) Intent intent = new Intent(this, AlarmManagerBroadcastReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(this, 0, intent, 0); AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); alarmManager.cancel(sender); Toast.makeText(this, 'Cancelled alarm', Toast.LENGTH_SHORT).show(); /** * This method enables the Broadcast receiver registered in the AndroidManifest file. * @param view */ public void enableBroadcastReceiver(View view) ComponentName receiver = new ComponentName(this, AlarmManagerBroadcastReceiver.class); PackageManager pm = this.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); Toast.makeText(this, 'Enabled broadcast receiver', Toast.LENGTH_SHORT).show(); /** * This method disables the Broadcast receiver registered in the AndroidManifest file. * @param view */ public void disableBroadcastReceiver(View view) ComponentName receiver = new ComponentName(this, AlarmManagerBroadcastReceiver.class); PackageManager pm = this.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); Toast.makeText(this, 'Disabled broadcst receiver', Toast.LENGTH_SHORT).show(); We add the AlarmManagerBroadcastReceiver in the manifest file. This registers the Broadcast Receiver. Once done, execute the code and you will notice the application as shown below.You can get the complete source at github/Code4Reference. You can find more Android tutorials here. Reference: Enable and disable Broadcast receiver during runtime from our JCG partner Rakesh Cusat at the Code4Reference blog.2012-08-28Rakesh Cusat Do you want to know how to develop your skillset to become a Java Rockstar?Subscribe to our newsletter to start Rocking right now!To get you started we give you our best selling eBooks for FREE!
This app starts the main HeHe activity at startup. The constructor of the HeHeActivity registers a handler using the android.os.Handle, which acts as a thread waiting for an object of type android.os.Message to perform different actions, which are outlined below.
If the received intent is of type android.provider.telephony.SMS_RECEIVED, the app extracts the contents of the SMS and the phone number of the sender. If the first three characters of the phone number matches the first three characters from phone numbers in a table named tbl_intercept_info, then the SMS intent is aborted and the SMS is deleted from the devices SMS inbox so that the user never sees it. After the SMS notification is suppressed, the app bundles the SMS as follows:
If the received intent is of type android.intent.action.PHONE_STATE, the app checks the tbl_intercept_info table in the local database. If the number of the caller appears in this table, then the ringer mode of the phone is set to silent to suppress the notification of the incoming call and the phone call is disconnected. Its corresponding entry from the call logs is also removed, removing all traces of the phone call from the device. 076b4e4f54