#StackBounty: #android #maven #bintray #jcenter Add Warning "A newer version of ….. is available" for custom library

Bounty: 50

I’ve just released my library with version 1.2.1, code is in Github

As you can see in the picture:
enter image description here

I’m getting “Warning” that i’m using old version of appcompat library but there’s no warning for my library.

I’ve distribute my library via Bintray to maven & jcenter.

Does anyone knows how to enable this Note/Warning on my library line?

Thanks very much!

Get this bounty!!!

#StackBounty: #android #google-play-services #google-oauth #google-authentication #android-broadcastreceiver android GoogleAuthUtil.get…

Bounty: 500

I have a background service that calls GoogleAuthUtl.getTokenWithNotification and it works properly but I’m trying to implement the callback portion of this function and that isn’t working properly.

I’ve implemented a broadcast receiver and added it to the manifest, I also have an activity in my app. Below are the relevant pieces of code.


GoogleAuthUtil.getTokenWithNotification(this.getContext(), account, "oauth2:" + GmailScopes.GMAIL_SEND, null, new Intent(AuthReceiver.AUTH_INTENT));


public class AuthReceiver extends BroadcastReceiver
    public final static String AUTH_INTENT = "com.testoauth.AUTH_INTENT";

    public AuthReceiver()

    public void onReceive(Context context, Intent intent)
        Log.d("RECEIVER", "Received Auth broadcast.");
        NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);


<receiver android:name=".AuthReceiver" android:enabled="true" android:exported="true">
        <action android:name="com.testoauth.AUTH_INTENT" />

I have no clue why it is not receiving the broadcast. I don’t see any exceptions in the logs and no indication that the receiver was called at all, it won’t even break on a breakpoint when debugging. Am I doing something incorrectly?


I’m using min sdk 15 and target sdk 22

From the GoogleAuthUtil.getTokenWithNotification API documentation:

This method is specifically provided for background tasks. In the
event of an error that needs user intervention, this method takes care
of pushing relevant notification. After the user addresses the
notification, the callback is broadcasted. If the user cancels then
the callback is not fired.

The callback is not fired regardless of the user canceling or not. Aside from gcm saying the notification has been displayed, there is no indication that the specified broadcast intent has been sent in the logs.

Get this bounty!!!

#StackBounty: #javascript #java #android #printing Android EPSON thermal Print data from web-view on click?

Bounty: 50

This is my Code here

Here In my activity I am using Epson SDK to print data form web-view to android activity..

So on Web-veiw Onclick It will start Printer Activity and It will print

What I am trying to do is….. OnClick from Web-view it will Open printer Activity so that it should print and Exit…

So here I have created a Web-view… With the help of JS it sill Open my activity form Web-view (onclick) till now its fine… But I tried to Add print and exit.. onclick but Its not working… Because I need to select language and Printer Model….

How ever in shared_DiscoveryActivity I am adding Printer and saved it in shared prefs… so it will not ask any more… its working

but In Main Activity I tried to remove buttons… But not wokring… I am getting Error (ERR_PARM) in printing… my code is fine..

Without Language and model no its not printing… I tried to give them in shared prefs but its not working…

Can any one help me to print the data OnClick from Web-view it will Open printer Activity so that it should print and Exit…

I have given my complete code.. if any ask me…
please suggest me on this kind plz…


In new update I have given my entire code from github with Web-view in assets folder…. Please suggest me on this kind

Update 1

Here In my Code I am struck here

mPrinter = new Printer(((SpnModelsItem) mSpnSeries.getSelectedItem()).getModelConstant(),
                               ((SpnModelsItem) mSpnLang.getSelectedItem()).getModelConstant(),

I am getting this at output for SpnModel , language and total mPrinter with both of them I tried same But I got this

    System.out:----- spnSeries -----android.widget.Spinner{24440249 VFED..C. ........ 0,444-466,516 #7f0e007b app:id/spnModel}
System.out: ----- lang -----android.widget.Spinner{1a6c617c VFED..C. ........ 0,604-366,676 #7f0e007d app:id/spnLang}
System.out: ----- printer -----com.epson.epos2.printer.Printer@b8250d6

System.out:----- spnSeries -----android.widget.Spinner{24440249 VFED..C. ........ 0,444-466,516 #7f0e007b app:id/spnModel}
System.out: ----- lang -----android.widget.Spinner{1a6c617c VFED..C. ........ 0,604-366,676 #7f0e007d app:id/spnLang}
System.out: ----- printer -----com.epson.epos2.printer.Printer@144a56f8

its Different always…

At initializeObject() in MainActivity… The Only thing is the if I overcome this manually or some other My printer is done.

On create only I am trying use runPrintReceiptSequence() But due to the above printer Language and Model selection I need to press a button.. I want to Do this without pressing a button or Do this language selection and Model selection from Shared Prefs… Like I have done adding Printer Discovery in shared_DiscoveryActivity.java

Please suggest me on this kind….

Get this bounty!!!

#StackBounty: #android #recyclerview #android-databinding #observablelist #android-binding-adapter Android data binding ObservableList …

Bounty: 100

I find it hard to spot the real raison d’etre of the android.databinding.ObservableList as a data binding feature.

At first it looked like a cool tool to display lists, through data binding, adding them via xml to a RecyclerView.
To do so, I made a BindingAdapter like this:

@BindingAdapter(value = {"items"}, requireAll = false)
public static void setMyAdapterItems(RecyclerView view, ObservableList <T> items) {
    if(items != null && (view.getAdapter() instanceof MyAdapter)) {
        ((GenericAdapter<T>) view.getAdapter()).setItems(items);

This way, I can use the attribute app:items in a RecyclerView with a MyAdapter set to it, to update its items.

Now the best feature of ObservableList is you can add an OnListChangedCallback to it, which handles the same events available in the RecyclerView to add/move/remove/change items in it without actually reloading the whole list.

So the logic I thought to implement was the fallowing:

  1. I start with an empty MyAdapter
  2. When my items are fetched from my APIs, I instantiate an ObservableArrayList wrapping them and pass it to the binding
  3. Data binding invokes my BindingAdapter passing the items to MyAdapter
  4. When MyAdapter receives new items, it clears its old ones and adds an OnListChangedCallback to the ObservableList received to handle micro-changes
  5. If anything changes in the ObservableList, MyAdapter will change accordingly without refreshing completely
  6. If i want to display a completely different set of the same items type, I can just re-set the binding variable, so the BindingAdapter will be invoked again and MyAdapter items will be completely changed.

For example, if I want to display items of type Game which I have two different lists for: “owned games” and “wishlist games”, I could just call binding.setItems(whateverItems) to completely refresh the displayed items, but for example, if I move the “wishlist games” around the list to organize them by relevance, only micro-changes will be executed within each list without refreshing the whole thing.

Turns out this idea was unfeasible because data binding re-executes the BindingAdapter every time a single change is made to an ObservableList, so for example I observe the fallowing behaviour:

  1. I start with an empty MyAdapter
  2. When my items are fetched from my APIs, I instantiate an ObservableArrayList wrapping them and pass it to the binding
  3. Data binding invokes my BindingAdapter passing the items to MyAdapter
  4. When MyAdapter receives new items, it clears its old ones and adds an OnListChangedCallback to the ObservableList received to handle micro-changes
  5. If anything changes in the ObservableList, the BindingAdapter is invoked again, thus MyAdapter receives the whole list again and completely refreshes.

This behaviour seems quite broken to me because prevents the ObservableList from being usable within an data-bound xml. I cannot seriously figure out a legit case in which this behaviour is desirable.

I looked up some examples: here and this other SO question

In the first link all the examples used the ObservableList directly to the Adapter without even passing form xml and actual data binding, while in the code linked in the SO answer, the developer did basically the same thing I tried to do, adding:

if (this.items == items){

at the beginning of his Adapter.setItems(ObservableList<T> items) to discard all the cases where the method is invoked because of simple changes in the ObservableList.

What is the need of this behaviour? What might be some cases where this behaviour is desirable? I feel like ObservableList is a feature added with data binding and is really useful except when used with actual data binding, in which case it forces you to defend from its behaviour.
If I declare it as a simple List in both xml data tags and in BindingAdapter signature, then I can cast it back to ObservableList inside MyAdapter and it works just fine, but this is quite a bad hack.
If it was just a separate feature from data binding, without triggering the binding at every change it would have been much better in my opinion.

Get this bounty!!!

#StackBounty: #android #caching #mvp MVP Adapter Data Cache

Bounty: 50

I’m developing project following MVP architecture. Usually, when I use recyclerView, my presenter controls Adapter data. But now I need to make recycler adapter with data from cache (or something like cache), recycler’s size dosen’t depends on cache size, so I make cache via HashMap where the key is – position of recycler, if there is an item in map then the data shows, else empty row with something like “add events” btn. And I can’t realize where the place for that cache in such structure – Model (Dao or something like CacheManager) or in Adapter.

The cache idea is following: I have some types of events which store in database, every event modifying changes it in db – so the cache has to be updated either.

The main questions are: where to keep this cache and load it to adapter, how can i keep it sync with database changes.

P.S. Also I tries to use RX, so if it can be solved with it – would be very interesting to try.

P.P.S If it the Repository pattern is the way to solve – welcome. Read about it sometime ago.

Get this bounty!!!

#StackBounty: #android #notifications #remote-input How to specify min and/or max length in RemoteInput

Bounty: 50

I use RemoteInput in my Android N notifications.

I want to set a min and max text length limit for the input.

Google Hangouts got this (i.e. the send button enables when the user entered at least 1 character). Anyone know how this can be done? I’ve tried to check the Android docs but no luck.

Get this bounty!!!

#StackBounty: #android Register my app as camera app in Android

Bounty: 50

I got help from android: how to register my app as "camera app" but still it’s not properly working

I have tried with my Contact App to add photo to my existing saved Contact, whom URI will be generated like below


but I can not access to that Contact app’s directory, so I can not save photo over that URI and if I do I will get FIleNotFoundException,

Uri saveUri = (Uri) getIntent().getExtras().getParcelable(MediaStore.EXTRA_OUTPUT);

if (saveUri != null)
    // Save the bitmap to the specified URI (use a try/catch block)
    outputStream = getContentResolver().openOutputStream(saveUri); <-----File Not Found Exception 

but same functionality is achieved by default Camera App

will anybody has suggestion how to resolve this issue


Get this bounty!!!

#StackBounty: #android #aes routines:EVP_DecryptFinal_ex:wrong final block length in android

Bounty: 200

Actually i work in a app and have a problem with decrypt AES

i have a error in this line byte[] results = cipher.doFinal(Base64.encode(text.getBytes("UTF-8"), Base64.DEFAULT));

error : error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length

String key = "grnR++15jgNFVmVg61UvQA==";
String data = "vrvwe+9wVhyNJmb/KcLD2K2j9gqkwVFXq0jt0qL7zyHHG2JWpkvr+VpG/QHm6INW01WsBZcpRYYk25bMtjWgLY6dzFNs3WLXZRMnVtIDhjuIfv0sp2RKvhjNLEu3Gscz4sdxYYS6XcLOWAY705Ll48+mA55Ke5WSq71jVR+TCJVT0w2nYZvzviE+N0QwRX5EZjCMjbaH4gpFLr+LsNevkAQ7e7Id4oSvrwqJ3PyUS4mo8OvPcUjKDhQCJc39k2aqBBaZ9O1AuqQqCOWpgy2XW9kacAP8zrcDRO7oNtSbIM0sqIyKS4PGzXiL+hw43hs33d/VO8tvLGHWOE0UvWkQY0QPJqzRDmmWpRTgr0Xt56UxIXjjAmteVlb+TWo3kzRSUQ2Un+ScCfEBHjaNJNShE27zSeXOjkMWpB0jobSMJy6KdR/fqopHmYcWd41DNOz25nkUtQBmBK+x5sqM0dLswL8TKfb7MdIdhqdZaHt7h1CTNpozEwg+A7ZEkcGZ3hcGAwPWkPrg1yoXE5uaeCzdslf4knbXBxIx8ekrBiyUY5BhMPak/7LJm9D64RPQEpdOUTeg2fh9nKShXnr1OdKGrf68H7c/rSincB2uqgEuo9oHaBIIwm0RuUkM/jCjeLmVEE2zIjJE2osk2XQKf4iOlHP12XQOCtITYBZm8jc0OKmjpelFaWNLFheAE/txRk/NSS+qmUcWor1BSXDZAxje0ftwTl0jYz69U3tW9pDm3yooWWU51ORoTpQHqEGLumQyJom3OfsSkQ/T/pEMxY6B3a7TmJ+8u+QJla+ZCHFav5aKL1Ojy7xijYzIlsoVP9m7nDp30oVA8rpI8vYKpUHXUuQPxdVV4/yjvCeRkWT/veQtHpA9OWYDSTQLdRYfOOeQoxg/kGua4HU0RlC8IVgm/iJJnpWJgvdKD0KKmVgwFKmZ1TFg5yMRN4oOPDk4yhtnjPV9VhJU4lHztHw7TG53UWblwieeorD+v94LHySXFAj1tyd4tebgrvFqyuPovT4iP7Xm37KA/LmtrCPiCaBn6g==;

        try {
        } catch (Exception e) {


String Decrypt(String text, String key) throws Exception {
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    byte[] keyBytes = Base64.decode(key.getBytes(), Base64.DEFAULT);
    SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");
    byte[] b = new byte[keySpec.getEncoded().length];
    System.arraycopy(keySpec.getEncoded(), 0, b, 0, b.length);
    IvParameterSpec ivSpec = new IvParameterSpec(b);
    cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
    byte[] results = cipher.doFinal(Base64.encode(text.getBytes("UTF-8"), Base64.DEFAULT));
    String  decoded = new String(cipher.doFinal(results), "UTF-8");
    return decoded;

Get this bounty!!!

#StackBounty: #android #ios #bonjour #multipeer-connectivity #dns-sd Android & iOS dns-sd: how to do a cross platform service disco…

Bounty: 50

On Android I’m doing this way to create a service broadcast with a simple attacched map as info

HashMap<String, String> record = new HashMap<>();
record.put("info, "my android info");    
WifiP2pDnsSdServiceInfo serviceInfo = WifiP2pDnsSdServiceInfo
        .newInstance("_myservice", "_tcp", record);
WifiP2pManager manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
Channel channel = manager.initialize(this, this.getMainLooper(), null);
manager.addLocalService(channel, serviceInfo, null);

to retrieve another signal

manager.setDnsSdResponseListeners(channel, this, this);

public void onDnsSdTxtRecordAvailable(String fullDomainName, Map<String, String> txtRecordMap, WifiP2pDevice srcDevice)

On iOS it’s the same service name and map of info

MCPeerID* _myPeerId=[[MCPeerID alloc] initWithDisplayName:@"my ios peer"];
NSDictionary* _serviceInfo=@{@"info": @"my ios info"};

MCNearbyServiceAdvertiser* _serviceAdvertiser = [[MCNearbyServiceAdvertiser alloc] 
         initWithPeer:_myPeerId discoveryInfo:_serviceInfo serviceType:@"myservice"];

MCNearbyServiceBrowser* _serviceBrowser=[[MCNearbyServiceBrowser alloc] 
      initWithPeer:_myPeerId serviceType:@"myservice"];

[_serviceAdvertiser startAdvertisingPeer];
[_serviceBrowser startBrowsingForPeers];

and the delegates

-(void)browser:(MCNearbyServiceBrowser *)browser lostPeer:(MCPeerID *)peerID
-(void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID withDiscoveryInfo:(NSDictionary<NSString *,NSString *> *)info

An Android device can see only another Android device, likewise between iOS devices. However, the two families can’t see each other.
I’d like to have them seen by other devices regardless of the operating system.

Get this bounty!!!

#StackBounty: #c# #android #xamarin #mono #xamarin.android How to stop a process from System.Diagnostics.Process and get the statistics…

Bounty: 100

I’m using this code but when i stop the process it not get the ping statistics :

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "ping";
p.StartInfo.Arguments = "-c " + count + " -i " + interval + " -s " + buffer + " -W " + timeout + " " + address;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;

string readData = "";

DateTime dt = DateTime.Now.AddSeconds(5);
if (p.Start())
    Scanner scanner = new Scanner(p.StandardOutput.BaseStream);

    while (scanner.HasNextLine)
        readData =  scanner.NextLine().ToString();

        if (!string.IsNullOrEmpty(readData) && !readData.StartsWith("---"))
            Match M = Regex.Match(readData, @"^[d]+ bytes from ([^:]+): [^ ]+ ttl=([d]+) time=([^ ]+) ms");

            if (M != null && M.Success)
                string IP = M.Groups[1].Value;
                string TTL = M.Groups[2].Value;
                string timeStr = M.Groups[3].Value;

                Console.WriteLine(String.Format("Ping to {0} took {2} ms with a ttl of {1}", IP, TTL, timeStr));
                // Parsing the timeStr will work the same way as above
               if(dt > DateTime.Now)
                Match M1 = Regex.Match(readData, @"^rtt [^0-9]*([d][^/]+)/([^/]+)/([^/]+)/([^ ]+) ms$");

                if (M1 != null && M1.Success)
                    float avgPingTime = 0;
                    float maxPingTime = 0;
                    float minPingTime = 0;

                    string minPingString = M1.Groups[1].Value;
                    string avgPingString = M1.Groups[2].Value;
                    string maxPingString = M1.Groups[3].Value;

                    // Now parse that value
                    float.TryParse(minPingString, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out minPingTime);
                    float.TryParse(avgPingString, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out avgPingTime);
                    float.TryParse(maxPingString, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out maxPingTime);

                    Console.WriteLine(String.Format("Min Time : {0} , AVG {2} ms, Max Time {1}", minPingTime, maxPingTime, avgPingTime));

Without using

if(dt > DateTime.Now)

the result display like this :

64 bytes from icmp_req=1 ttl=46 time=13.9 ms
64 bytes from icmp_req=2 ttl=46 time=13.9 ms
64 bytes from icmp_req=3 ttl=46 time=13.9 ms

--- ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 3016ms
rtt min/avg/max/mdev = 13.910/13.926/13.951/0.010 ms

but if I stop the ping using p.StandartInput.Write("x3"); it never goes to the statistics part it hangs at sequence 1 and dont continue reading , how to show the statistics after stoping the ping process ?

in other words my problem is when the user want to stop the ping it should display the statistics for the certain time that it was used to ping…


I have implemented p.StandartInput.Write("/x3"); and it interrupts the ping process but it does not display the statistics and just hangs there.

Get this bounty!!!