Thursday, 20 June 2019

Generate signed apk

https://stackoverflow.com/questions/4617898/how-can-i-give-an-imageview-click-effect-like-a-button-on-android/4618185

https://www.androidhive.info/2017/12/android-working-with-bottom-sheet/

https://stackoverflow.com/questions/35101987/android-studio-does-not-recognize-my-xiaomi-redmi-note-3/46930037

//generate realease SHA key store
=================================

https://code.luasoftware.com/tutorials/android/get-sha1-fingerprint-of-keystore-certificate-jks/
path of bin

C:\Program Files\Android\Android Studio\jre\bin
keytool -list -v -keystore {keystore.jks} -alias {alias_name}

(C:\Program Files\Android\Android Studio\jre\bin>keytool -list -v -keystore E:\Manisha/Project/Guruji Developers/Keystore/guruji.jks -alias guruji


https://github.com/Suleiman19/Android-Material-Design-for-pre-Lollipop

D7:55:BD:62:DC:DA:52:81:56:B1:B5:6B:F1:D4:8F:E7:E2:15:E8:6D


https://github.com/florent37/ExpansionPanel
ExpansionTextView for less more

Sunday, 22 July 2018

recycler view with stickey header android

https://github.com/TellH/RecyclerStickyHeaderView

Recycler view with apha index android
https://github.com/YoKeyword/IndexableRecyclerView

Wednesday, 20 June 2018

naugat file path

1)<provider
    android:name="android.support.v4.content.FileProvider"    android:authorities="com.android.devicebroadcast.android.fileprovider"    android:exported="false"    android:grantUriPermissions="true">

    <meta-data        android:name="android.support.FILE_PROVIDER_PATHS"        android:resource="@xml/file_paths" />
</provider>
2)File Helper
public static Uri getContentUri(Context context, Uri uri) {
   if (uri.getScheme() == "content")
      return uri;
   return FileProvider.getUriForFile(context,
         "com.callrecorder.android.fileprovider",
         new File(uri.getPath()));
}

Tuesday, 19 June 2018

List of running processes

1) https://github.com/jaredrummler/AndroidProcesses
2) https://www.android-examples.com/get-show-all-background-running-process-in-android/
//1)//        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);//        final List<ActivityManager.RunningTaskInfo> recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE);////        for (int i = 0; i < recentTasks.size(); i++)//        {//            Toast.makeText(this,"Application executed : " +recentTasks.get(i).baseActivity.toShortString()+ "\t\t ID: "+recentTasks.get(i).id+"",Toast.LENGTH_LONG).show();//            Log.e("Executed app::", "Application executed : " +recentTasks.get(i).baseActivity.toShortString()+ "\t\t ID: "+recentTasks.get(i).id+"");//        }//2//        ActivityManager actvityManager = (ActivityManager)//                this.getSystemService( ACTIVITY_SERVICE );//        List<ActivityManager.RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();////        for (int i = 0; i < procInfos.size(); i++){//                        Toast.makeText(this,"Application executed : " +procInfos.get(i).processName + "\t\t ID: "+procInfos.get(i).pid+"",Toast.LENGTH_LONG).show();//                        Log.e("Executed app::", "Application executed : " +procInfos.get(i).processName + "\t\t ID: "+procInfos.get(i).pid+"");//////        }//3        ActivityManager activityManager = (ActivityManager)
                this.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningTaskInfo> tasks = activityManager.getRunningTasks(Integer.MAX_VALUE);

        final PackageManager pm = getApplicationContext().getPackageManager();
        ApplicationInfo ai;

        for (ActivityManager.RunningTaskInfo task : tasks) {

            try {
                ai = pm.getApplicationInfo(task.baseActivity.getPackageName(), 0);
            } catch (final PackageManager.NameNotFoundException e) {
                ai = null;
            }
            String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai): "(unknown)");
                        Toast.makeText(this,"Application executed : " +applicationName,Toast.LENGTH_LONG).show();
                        Log.e("Executed app::", "Application executed : " +applicationName);
//        }

Sunday, 17 June 2018

End call programatically android



1)
if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
    savedNumber = intent.getExtras().getString("android.intent.extra.PHONE_NUMBER");
    if(savedNumber == "123456"){
        TelephonyManager tm = (TelephonyManager) context.getSystemService(TELEPHONY_SERVICE);

        Method m1 = null;
        try {
            m1 = tm.getClass().getDeclaredMethod("getITelephony");
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        m1.setAccessible(true);
        Object iTelephony = null;
        try {
            iTelephony = m1.invoke(tm);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

        Method m3 = null;
        try {
            m3 = iTelephony.getClass().getDeclaredMethod("endCall");
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        try {
            m3.invoke(iTelephony);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        Intent miIntent1 = new Intent(context, MainActivity.class);
        context.startActivity(miIntent1);
    }
}
else{
    String stateStr = intent.getExtras().getString(TelephonyManager.EXTRA_STATE);
    String number = intent.getExtras().getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
    int state = 0;
    if(stateStr.equals(TelephonyManager.EXTRA_STATE_IDLE)){
        state = TelephonyManager.CALL_STATE_IDLE;
    }
    else if(stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){
        state = TelephonyManager.CALL_STATE_OFFHOOK;
    }
    else if(stateStr.equals(TelephonyManager.EXTRA_STATE_RINGING)){
        state = TelephonyManager.CALL_STATE_RINGING;
    }


    onCallStateChanged(context, state, number);
}

2)https://stackoverflow.com/questions/20965702/end-incoming-call-programmatically/21013894

public void disconnectCall(){
 try {

    String serviceManagerName = "android.os.ServiceManager";
    String serviceManagerNativeName = "android.os.ServiceManagerNative";
    String telephonyName = "com.android.internal.telephony.ITelephony";
    Class<?> telephonyClass;
    Class<?> telephonyStubClass;
    Class<?> serviceManagerClass;
    Class<?> serviceManagerNativeClass;
    Method telephonyEndCall;
    Object telephonyObject;
    Object serviceManagerObject;
    telephonyClass = Class.forName(telephonyName);
    telephonyStubClass = telephonyClass.getClasses()[0];
    serviceManagerClass = Class.forName(serviceManagerName);
    serviceManagerNativeClass = Class.forName(serviceManagerNativeName);
    Method getService = // getDefaults[29];
    serviceManagerClass.getMethod("getService", String.class);
    Method tempInterfaceMethod = serviceManagerNativeClass.getMethod("asInterface", IBinder.class);
    Binder tmpBinder = new Binder();
    tmpBinder.attachInterface(null, "fake");
    serviceManagerObject = tempInterfaceMethod.invoke(null, tmpBinder);
    IBinder retbinder = (IBinder) getService.invoke(serviceManagerObject, "phone");
    Method serviceMethod = telephonyStubClass.getMethod("asInterface", IBinder.class);
    telephonyObject = serviceMethod.invoke(null, retbinder);
    telephonyEndCall = telephonyClass.getMethod("endCall");
    telephonyEndCall.invoke(telephonyObject);

  } catch (Exception e) {
    e.printStackTrace();
    Log.error(DialerActivity.this,
            "FATAL ERROR: could not connect to telephony subsystem");
    Log.error(DialerActivity.this, "Exception object: " + e); 
 }

3)http://deepshikhapuri.blogspot.com/2017/06/hide-and-unhide-app-icon-in-android.html

Sunday, 27 May 2018

Multi contact select picker

1) https://stackandroid.com/tutorial/contact-picker-using-intent-android-tutorial/
2) https://github.com/sachinmuralig/simple-multi-contact-picker
3) https://stackoverflow.com/questions/15620805/how-to-select-multiple-contacts-from-the-phone-using-checkboxes?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Sunday, 31 December 2017

OTP view

Link: https://github.com/mukeshsolanki/android-otpview-pinview

.....
dependencies {
  ...
  compile 'com.mukesh:otpview:1.0.1'
}
<com.mukesh.OtpView
      android:id="@+id/otp_view"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="#cccccc"
      android:inputType="number"
      android:textColor="#FFFFFF"
      app:otp="1234"
      app:text_background_color="@color/colorAccent"
      >
</com.mukesh.OtpView>