• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps NetworkStatsManager querySummaryForDevice strange results

I want to get the mobile data consumption for a given range of date (1, 2, 5, 10 or 15 minutes) with the querySummaryForDevice method of NetworkStatsManager.

This is my code:

Java:
public static long getTotalTrafficInRange(Context context, Date fromDate, Date toDate) throws UsageStatsNotActiveException, NoPermissionException
{
   boolean usageStatsActive = doIHavePermission(context);

   if (!usageStatsActive) {
       throw new UsageStatsNotActiveException(context);
   }

   long total = 0;

   TelephonyManager tele = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
   if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
       throw new NoPermissionException(Manifest.permission.READ_PHONE_STATE);
   }
   String actualSubscriberId = tele.getSubscriberId();

   NetworkStatsManager networkStatsManager = (NetworkStatsManager) context.getSystemService(Context.NETWORK_STATS_SERVICE);

   Date from = ConvertDateToCalendar(fromDate);
   Date to = ConvertDateToCalendar(toDate);

   //Total
   NetworkStats.Bucket bucket;
   try {
       bucket = networkStatsManager.querySummaryForDevice(ConnectivityManager.TYPE_MOBILE, actualSubscriberId, from.getTime(), to.getTime());

       if(bucket != null){
           total = (bucket.getRxBytes() + bucket.getTxBytes());
       }

   } catch (RemoteException e) {
       e.printStackTrace();
   }

   return total;
}

I tried to convert my date in calendar and back again in Date with this code:

Java:
public static Date ConvertDateToCalendar(Date date)
{
   Calendar fromDateCalendar = Calendar.getInstance();
   fromDateCalendar.setTime(date);

   Calendar calendar = Calendar.getInstance();
   calendar.set(Calendar.YEAR, fromDateCalendar.get(Calendar.YEAR));
   calendar.set(Calendar.MONTH, fromDateCalendar.get(Calendar.MONTH));
   calendar.set(Calendar.DAY_OF_MONTH, fromDateCalendar.get(Calendar.DAY_OF_MONTH));
   calendar.set(Calendar.HOUR_OF_DAY, fromDateCalendar.get(Calendar.HOUR_OF_DAY));
   calendar.set(Calendar.MINUTE, fromDateCalendar.get(Calendar.MINUTE));
   calendar.set(Calendar.SECOND, fromDateCalendar.get(Calendar.SECOND));
   calendar.set(Calendar.MILLISECOND, fromDateCalendar.get(Calendar.MILLISECOND));

   return calendar.getTime();
}

This is the fromDate and toDate:

Java:
//this date is new Date() minus 1,2,3,5,10 or 15 minutes, not more then this values
   fromDate = new Date(PersistentHelper.getLastDateUsedForCalculateData(context));

   //Calculate toDate
   Calendar calendar = Calendar.getInstance();
   calendar.setTime(new Date());
   if(!userChangeDateManually || !userChangeZone) {
       calendar.set(Calendar.SECOND, 0);
   }
   calendar.add(Calendar.MILLISECOND, -1);

   toDateWS = calendar.getTime();

But totalBytes returned by getTotalTrafficInRange it's not real. If I have my phone in WIFI for 1 hour and then call my function with fromDate 15 minute ago, it return a very long value and not 0 as expected.

There is a limit for the range date of the querySummaryForDevice method of NetworkStatsManager? No clue found in documentation.

Anyone notice this weird behaviour?

Phone lock

I've noticed that when i first got this phone whenever i would press the power button to turn it off then turn it back on it would be locked. Now whenever i do it it stays unlocked unless its been off for a sertain amount of time. I was wondering if there is a way to put it as it was before?

Mini Speedy Racers [FREE] [Game]

Take a look at our New Game #MiniSpeedyRacers is exciting and fun to play racing game, here is the description:

Join the Mini Speedy Racers league and compete against crazy mini mad drivers in this extremely fun and entertaining racing game.

This is not your typical serious racing game, no this is a different kind of racing game. Pick your racer, select your track, and speed up! You can bump against other mini speedy racers, pick up tricks to make fun of them, pick up turbos to speed up, and just make sure to cross the finish line ahead of all them to celebrate.

The game includes many good-looking retro style racers, challenging tracks, several nice cartoonish environments, and many tricks.

If you like racing and have a good laugh while doing it, then this game is for you! Don’t waste time, download it and have fun! "

Here is the link to the Play Store, and the game is FREE:

https://play.google.com/store/apps/details?id=com.fierrostudios.minispeedyracers

Take a look and let us know what you think!

Racers_0_960x540.png

Just A Noob! But a total DIY noob!

What's up fellow Android users!!

Honestly, I'm not exactly sure what took me so long to FINALLY join but I'm HERE NOW!

I'M NO HACKER FYI. But I do have a few neat Android tricks up my sleeves and I know there are MANY others out there who know plenty more!!

So I'd like to build my network here and learn from EACH OTHER!:

SOUND GOOD?!

I'll be doing DIY Android stuff here too!

Screen shutting down by itself

Hi All!
Since two days ago my S8 is getting its screen shutting down.
The touch screen still working, sounds, videos, etc.
In order to get the screen back, I have to press Power twice to get back to Lock Screen, than unlock and get back to whatever I was doing.

Fun fact, if my phone is being charged, I have zero issues. Doesn't matter the source...car charger, Xbox, normal cable, etc.
It only occur when the phone is not being charged.

I have done:
Safe Mode, Wipe Cache, and Factory Reset. In all scenarios the screen still have the same behavior.

Also, the LED indicator is always solid blue when the phone is unlock/being used.
No water damaged occurred or high impact accident.

What am I supposed to do?

I'm am donating to charity

For the 1st time ever im donating 5% of sny donstion i recive to help fund my projects to charity.

The most one i want to donate to is charities with kids with disbilities and as well children living witj cancer to help researcher find a way to cure and get rid of cancer permenantly

If you have GamerROM Orion on the Nexus 6 you will now see a new option called Donate in the "OTA Updates" app where you can click and donate however we highly require you to pre sign into your paypal to be sble to donate for some odd reason the app will not recgonize the full url so i had to shorten it using bit.ly to get it working, ill find other ways to get it without signing in but it works.

However if your interested in me reaching my goal of $50,000 to donate to charity and if we reach that goal $48,000 will go into both charities leaving $2,000 for my servers to stay online longer will you help me reach the goal to help those in need? You can also donate below:

Donate to charity: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TCJKHJH9FG9SJ&source=url

[Game][Beta] Bubble Bash

My new game, Bubble Bash, is now available on the google play store. It is currently in the Beta testing stage. I would greatly appreciate any feedback and hope that you enjoy it. It is my first game and was very time consuming as I did not use a game engine and there were a lot of learning curves. It is an arcade game and involves hitting a ball into bubbles using a paddle. I am aware that there is a lot of room for improvement for the UI and gameplay and I am very open to incorporating any ideas from feedback into the game.

I find that the game can be kinda exhilarating if you really challenge yourself. It is a good game for improving focus and hand-eye coordination as these qualities are required to be good at it. I wanted to make it interactive for users and have incorporated gyroscopic controls for the paddle angle as well as touch motion for moving the paddle on the screen.

Google Play Link: https://play.google.com/store/apps/d...com.bubblebash

Attachments

  • Screenshot_2019-05-07-19-54-58.png
    Screenshot_2019-05-07-19-54-58.png
    116.6 KB · Views: 124

Divider is not displayed in Spinner in Dialog.

------------------------------------------------- manifests


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fec.drawinglibrary_sample">

<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />


<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@Mipmap/ic_launcher"
android:label="@String/app_name"
android:roundIcon="@Mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@Style/AppTheme">
<activity
android:name="fec.raderapp.MainActivity"
android:label="@String/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>


---------------------------------------------------------------------style.html

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:dropDownListViewStyle">@style/SpinnerStyle</item>
</style>

<style name="SpinnerStyle" parent="Widget.AppCompat.ListView.DropDown">
<item name="android:divider"> @color/titleColor</item>
<item name="android:dividerHeight"> 0.5dp </item>
</style>
</resources>



----------------------------------------------------- Spinner in Dialog

<LinearLayout
android:id="@+id/_Palett_Event_Layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:minWidth="25px"
android:minHeight="25px"
android:eek:rientation="horizontal">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:eek:rientation="vertical"></LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:eek:rientation="vertical">

<Spinner
android:id="@+id/_Palett_Spinner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:eek:verlapAnchor="false"
android:popupBackground="@color/menuColor"
android:spinnerMode="dropdown"
android:theme="@Style/SpinnerStyle" />
</LinearLayout>
</LinearLayout>





The current code.

It can not be expressed only in Spinner in Dialog.
Why is this happening?

Abstracting Async?

I have an Async private inner class that I'm implementing on every Activity, that gets HTML from a URL. With the exception of the URL, it's the same in every Activity.

I'm wondering how to go about abstracting it so that i can just pass in the URL and get the response back. I'm having two problems with this: 1) I need a context to pass to the requestQueue, and 2) I need a way to get the data back.

I have tried implementing the code a standalone Async class but I keep getting errors trying to pass the context (says the context can't be applied to HTMLLoader). The next thought I had was to implement a regular class, then to use an Async class in the Activity, get the context from there, and pass that in - but I get the same error, just in the activity's async class instead.

I'm going to have a few activities needing to access various URLs so I don't want to keep repeating the same private inner class over & over. It might work, but it's not a clean solution. It's probably something about Java or Android that I don't know, but unfortunately, I don't know what it is I don't know... Any suggestons appreciated.

Here's the inner class code:
Code:
private class HTMLLoader extends AsyncTask<Void, Void, Void> {
    @Override
    protected Void doInBackground(Void... params) {
        try {
            Thread.sleep(2000);
        }
        catch (java.lang.InterruptedException interruptedException) {

        }
        RequestQueue queue = Volley.newRequestQueue(SecondActivity.this);
        String url = "http://10.0.2.2";

        StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        mTextBox.setText(response);
                        mProgressBar.setVisibility(View.INVISIBLE);
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                String err = error.toString();
                mTextBox.setText(err);
                mProgressBar.setVisibility(View.INVISIBLE);
            }
        });
        queue.add(stringRequest);
        return null;
    }
}

Android Auto random volume changes and chimes

Greetings,

Samsung J7 Prime - SM-J72711
Android 8.1.0
Baseband - J727T1UVS5BSC2
Kernal - 3.18.14-14133265-QB22566678
Build - M1AJQ.J727T1UVS5BSC2
Ford Sync 3

Problem #1 - Volume goes up and down while streaming music (Amazon, iHeart).
It's similar to when Waze lowers the volume to deliver a message.
I tried the following:
Uninstalled Waze, still happens.
Disabled all app notifications, still happens.
If I bypass AA and stream via bluetooth the volume does not change.

Problem #2 - Chimes while speaking on phone.
Just loud enough to be annoying. It's a 4 note chime. Happens at random intervals only while speaking on the phone.
I have tried the following:
Bypass AA and speak via bluetooth, no chimes.

The former has been happening for months, the later is a new issue.

I have searched and searched for solutions, must not be common problems because I can find very little info these.

tia

I need help

Hy. Can someone help me from support because I have a little problem whit my phone. As ushually I download a new actualisation for my android and my phone after the actualisation wants from me password, ok but I tape the password to my phone and it was wrong. I know that password but my phone dont accept it. please have someone an idea what to do. I have in that phone my working stuff and i dont want to lose it.

The famous program Language Enabler to add lost language from your phone without root.

Does your phone not have your country's language, or do you want to change the whole language to another language that isn't on the phone?

1.Go to Settings

2.Scroll down to the bottom and tap About phone

3.Find and tap Software information

4.Locate the Build Number field and Tap the Build number field seven times, to enable Developer Options. When you are done, you'll see the message Developer mode has been enabled. Go back to the settings, scroll down to the bottom and you'll see the Developer options menu. Now, you can enable USB Debugging mode: In Settings menu, go to Developer Options, scroll down find USB Debugging and enable it.

5.Enable USB Debugging and you will get RSA Key Notification

6.Select Always allow from this computer, and tap OK

now connect your phone and open the program wait for 7 sec and you will see the app in phone

S10PLUS google play store stops download when screen is off

Play store stops downloading apps when the screen is turned off. Sometimes, it says "waiting for wifi" but most of the time, the download just stops and it needs to start again. It makes me irritated because i cant download apps when im not using the phone. I already tried to clear the cache and date of play store and also, restarting the phone. Internet is not the problem cause i got a stable connection

OrangeFox Recovery for Orbic Wonder

Well I decided to not leave the Orbic scene after seeing the groundbreaking breakthrough by @noidodroid where he managed to network unlock a Verizon variant Orbic for GSM usage. Truly impressive, and very much looking forward to the method for how to do that. To celebrate such an occasion I bring to you all yet another recovery. Sorry for so many recoveries, but it's all we can do now since we don't have proper sources yet to build a ROM or something

This is OrangeFox Recovery. Think RedWolf but orange. And also MTP works apparently so thats cool

WHAT WORKS/DOESNT WORK:
  • Gonna be the same as my RedWolf one probably... phone shows up as a Redmi 3s because of the nature of dirty ports, and oem/vendor won't mount but everything else should (if data doesn't you need to flash the disable-verity zip and factory reset)
DOWNLOADS:
  • LINK TO THE ORANGEFOX FOLDER ON THE REPO. There's two files, a standard recovery image to flash in fastboot and a flashable zip you can flash in another custom recovery. I'm not sure if the flashable zip works though so use with caution, but the flashable zip version will provide some other additional cool tools to play with if it does work
  • LINK TO THE REST OF THE REPO TO SEE ALL OUR OTHER STUFF
  • Again I can't give source code for anything unfortunately because we're working with dirty ports here (because we ourselves have no source code for the phone or we'd be doing this the right way) but please feel free to use any and all of my images on the repo above for anything you want. It's a community effort here to get this phone pulled away from the dark side of the force
THANKS TO:
  • Team Orbic for restoring my faith in this phone and the project, and for testing this out too since I don't have an Orbic to work with myself
  • XDA user zhantech for making OrangeFox for the Redmi 3s which we ported it from
  • Carliv Image Kitchen for letting me do all these gnarly dirty ports

Detect movement on display (NOT camera, but screen movement)

Hi all,
Is there any app that can be used to detect movement on what is being displayed on the screen. So not using the front or rear camera.

The use case is a wireless endoscope camera, you connect to the wireless signal and it streams the feed direct to your phone (not connected to internet, just 30m away from the transmitter box). I want to then leave my screen open and if there is any movement on the screen for it to alert me.

I understand it will drain battery having the screen on for hours but I dont mind that, its for watching wildlife.

There is no app available that will connect to my endoscope camera that also has motion detection and the only way I can think of getting this to work is having a second phone pointing at the first phone and have the motion detection on the second phone haha. If i can do it all on one phone that would be great but not sure if there is any app that will notify me of changes in the feed of an app, or change of the display.

Any ideas?

App review for creating shortcuts on Home Screen to folders

Just thought I'd write a short review of an app aptly named Shortcut Creator which I’m using on a Samsung Galaxy Tab S4 I recently purchased from T-Mobile. I was looking for a simple to use app that would allow me to put shortcuts to specific folders & files onto my home screen because I don’t want to go digging through my settings file folder menus to access media files that I frequently use. I tried several different kinds of short cut creators but found they either were not suitable for my purposes or they were too complicated to set up. I finally discovered this app on Google Play https://play.google.com/store/apps/details?id=com.alextern.shortcuthelper and I love it! Shortcut Creator is very easy to use and it let me put shortcuts to songs, photos, videos and documents on my home page. I definitely recommend this app.

Help Matching Qi Charger and External Receiver Coil for Nexus 7 WiFi Only?

As my wife is disabled, I need a Qi charging station that positions the Nexus 7 Wifi-only (2013) tablet and also an external receiver coil that I'll have to purchase as well. The external coil must be precisely positioned on the back of the Nexus 7 WiFi-only (2013) tablet to match the station's coil -- and as far as I can see the add-on receiver coils don't give you flexibility in positioning the coil. That means the station and the coil must be matched with respect to the Nexus 7 WiFi-only (2013) form factor.

So, I go off to search but then a big problem is that Amazon's search restrictions (left column) don't let you specify Nexus 7 compatibility. Entering "nexus" as a search term doesn't seem to matter either. Moreover, even if I found one or the other, I'd be risking taking shipment on 2 items that aren't geometric matches.

I've considered manufacturing a charging alignment frame as in
but it seems someone somewhere must have something like this for sale. Moreover, it seems someone somewhere must have an external receiver coil kit for the Nexus 7 WiFi-only (2013) that precisely positions the coil to match the position of the Nexus 7 (2013) phone tablet's internal receiver coil.

Filter

Back
Top Bottom