Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
cubicle gangster
Jun 26, 2005

magda, make the tea
Me again.

I wanted to use the play store's beta testing program to host our presentations so we can remotely update them (until we get a real developer in to rewrite everything), but it doesn't seem to work. I've uploaded and published the apk, set up the beta testing list, clicked on the opt in link - but when I click any link to take me to the app in the google play store or download I get a "We're sorry, the requested URL was not found on this server."
This is the second app i've uploaded to try this and it's been 48 hours since both of them went up, anyone know why they wouldn't be accessible? Doesn't matter if logged in or not, spits out the same error.

cubicle gangster fucked around with this message at 14:45 on Jun 14, 2016

Adbot
ADBOT LOVES YOU

speng31b
May 8, 2010

You need to be accessing the link while signed into a google account that's authorized for the beta. Make sure you're signed into a google account that has specifically accepted the beta invite, or I'm pretty sure you can grant your google account org permissions to view the link. That should get you started in the right direction.

cubicle gangster
Jun 26, 2005

magda, make the tea
I have. I have 3 email accounts and they are all signed up for the beta. I've done the opt in link, I got page saying 'congratulations you're in the beta, click here to download, and the link takes me to a page that says "We're sorry, the requested URL was not found on this server."
Going straight from the developer console does the same thing.

speng31b
May 8, 2010

Try signing in using an incognito tab? Sometimes google account auth gets confused if you have multiple google accounts.

cubicle gangster
Jun 26, 2005

magda, make the tea
OK, so that worked! bizarre, but thank you.

Now the problem is still that nobody else in the group can see it either... if everyone I send this to has to use incognito mode that's not really ideal. I'll have a think what to do.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Anyone know why RenamingDelegatingContext is deprecated? It says "New tests should be written using the Android Testing Support Library", but I'm using it to redirect cache dir / database calls to a separate test version. I can't really see how you're meant to replicate that with anything in the support library, but I'm probably missing something about how it works

speng31b
May 8, 2010

Yeah, that's weird. The android docs site shows it as deprecated, but in the google android source browser on master, it's not, and on the latest android-n preview tag, it's not:

https://android.googlesource.com/platform/frameworks/base/+/android-n-preview-3/test-runner/src/android/test/RenamingDelegatingContext.java

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Bit strange huh? I'm guessing they're moving that way, unless someone messed something up? I was just wondering if there's anything in the support library to replicate that kind of functionality in a more general way - like a TemporaryContext rule or something that cleans itself up, that would be nice

Vagrancy
Oct 15, 2005
Master of procrastination

baka kaba posted:

Anyone know why RenamingDelegatingContext is deprecated? It says "New tests should be written using the Android Testing Support Library", but I'm using it to redirect cache dir / database calls to a separate test version. I can't really see how you're meant to replicate that with anything in the support library, but I'm probably missing something about how it works

Maybe they're pushing you towards using the embedded Junit4 implementation in that support library? This seems like a promising primer:
http://www.singhajit.com/testing-android-database/

That or there's an update to the library which hasnt gone live yet.


speng31b posted:

Yeah, that's weird. The android docs site shows it as deprecated, but in the google android source browser on master, it's not, and on the latest android-n preview tag, it's not:

https://android.googlesource.com/platform/frameworks/base/+/android-n-preview-3/test-runner/src/android/test/RenamingDelegatingContext.java

Problem is thats the Dev3 source, the docs are the referring to NDev 4/finalised API 24 which they released today.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Vagrancy posted:

Maybe they're pushing you towards using the embedded Junit4 implementation in that support library? This seems like a promising primer:
http://www.singhajit.com/testing-android-database/

Yeah that's what I'm already doing though - RenamingDelegatingContext just wraps the one you get from getTargetContext, and appends a prefix to things like database names and folders. It basically creates separate test/temp versions when you run your code within the test, instead of stepping all over the real app data

It's possible there's a better way of doing that integrated into the test suite now, or maybe I'm missing something about the contexts that are available, but I can't see anything different

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Can anyone help me out with Coverage in Android Studio? I've never had this problem before, but now when I run unit tests with coverage (default settings) the resulting suite lists everything - the Android framework, Java libraries, everything. I can drill down to my package but I never had to do this before, from what I can remember

If I edit the configuration to only record coverage data for my app's package, that eliminates most of it, but I'm still getting stuff from the build folder. I don't need to see Dagger's factories or how much of R are being covered, because the answer is zero because these are unit tests with mocked interfaces, so none of those classes will ever be touched. So is there a way to exclude these? I don't think I've ever even see things like R pop up before

I'm just using the IntelliJ IDEA code coverage runner, haven't done anything with JaCoCo or anything like that. I'm a bit confused to be honest because it's always Just Worked before and I can't find anything dealing with it, just people writing JaCoCo config filters

Leandros
Dec 14, 2008

Is there any way to program Live Wallpapers using QT? I want to familiarise myself with Android development and thought this would be a nice way to do it, as I have some ideas I want to work out and prefer to stick to C++. I could turn them into regular old apps (QT can do that for sure), but they can be implemented as wallpapers as well so it seemed like a fun way to learn bit by bit. The internet has essentially no answers on this subject however, so I was hoping someone here knows.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Leandros posted:

Is there any way to program Live Wallpapers using QT? I want to familiarise myself with Android development and thought this would be a nice way to do it, as I have some ideas I want to work out and prefer to stick to C++. I could turn them into regular old apps (QT can do that for sure), but they can be implemented as wallpapers as well so it seemed like a fun way to learn bit by bit. The internet has essentially no answers on this subject however, so I was hoping someone here knows.

Android actually has C++ code support classes (E.g. NativeActivity) that act as implementation shims, so if you are philosophically opposed to writing even the tiniest bit of Java you're still covered. Not sure how well that would work for Live Wallpapers but realistically you could just delegate everything via JNI calls to the C layer.

I would be really surprised if there was a QT translation library but I wouldn't be surprised if something was out there.

Live Wallpapers may be a hard way to learn Android.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

If I remember you can just get the Canvas from the wallpaper's Surface and do all your drawing to that, so depending on what Qt is doing it might be fairly simple to get working

Trouble is it's dog slow, especially if you have any overdraw. For any real performance, unless things have changed, you need to use OpenGL

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
By default you should be getting a GLSurfaceView, if I vaguely remember the docs.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Yeah but you can call getHolder and then lock the canvas and draw on it, you don't actually need to use OpenGL. I think most tutorials take the canvas approach since it fits into the basic Android graphics framework so easily (and you don't have to learn OpenGL of course)

I did it once and with a couple of fullscreen layers it was chugging. And with things like wallpapers you want a minimal performance hit, so yeah - it's worth a try, but OpenGL is hilariously fast in comparison. Or it was, this was around Jelly Bean times

Leandros
Dec 14, 2008

Alright, thanks, I'll look into it. I have no experience with OpenGL, just plain C++ and QT. The program itself is not necessarily heavy, it depends on how big I'll make the number of objects that will be in it, so that should be ok with some tinkering.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Leandros posted:

Alright, thanks, I'll look into it. I have no experience with OpenGL, just plain C++ and QT. The program itself is not necessarily heavy, it depends on how big I'll make the number of objects that will be in it, so that should be ok with some tinkering.

What were you planning on making, if you don't mind my asking? It's typically a mistake to try to glom existing WM concepts onto Android.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Leandros posted:

Alright, thanks, I'll look into it. I have no experience with OpenGL, just plain C++ and QT. The program itself is not necessarily heavy, it depends on how big I'll make the number of objects that will be in it, so that should be ok with some tinkering.

It's not the memory use, it's the drawing operations. If you're redrawing your display every frame then you have 16ms to get everything done, and Canvas is relatively slow - you can be cleverer about it (only drawing when there's a change, only redrawing dirty regions) but then it's turning into a much more complex system. OpenGL works in a whole different way, and that would probably be a lot harder to just drop your results into

If you want to give the Canvas approach a try, you can try something like this:
http://code.tutsplus.com/tutorials/create-a-live-wallpaper-on-android-using-an-animated-gif--cms-23088
and just put your code between Canvas canvas = holder.lockCanvas(); and holder.unlockCanvasAndPost(canvas);.

I don't really know anything about Qt though, or what it outputs - there's chat on the internet about using something called QtQuick? And giving it an OpenGL context as a render target. Depending on what you're doing, there might be a really easy solution

Super Dude
Jan 23, 2005
Do the Jew
I've been learning about Job Scheduler, and I'm really confused about how to make it periodically run a job only when the phone is plugged in and I have wifi access. If I call setPeriodic, it seems to ignore the setRequiresCharging and network requirements. What am I missing?

code:
JobInfo job = new JobInfo.Builder(1,
                new ComponentName(getPackageName(),
                        MyJobService.class.getName()))
                .setRequiresCharging(true)
                .setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED)
                .setPeriodic(5000)
                .build();
JobScheduler jobScheduler =
                (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
        jobScheduler.schedule(job);

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Good news!
https://code.google.com/p/android/issues/detail?id=81265
So yeah looks like it's being treated as a deadline that overrides everything else, and the 'requirements' end up being preferences

I guess it makes sense (without having a force flag anyway), if you want to run something within a day but only when charging, it's possible that it won't run at all. So you can use setOverrideDeadline to make sure that it definitely happens within a certain window. setMinimumLatency lets you set the start of that window, which lets you make sure the next job doesn't happen until sometime within the next day. So setPeriodic is like a convenience method that does both - it sets the end of the current window, but if the job starts before the end, it automatically delays the next job until the current window has ended.

If you want your job to run at the next possible opportunity, but then delay the next run for at least 5 seconds, you probably want to handle the rescheduling in your job service. Have a look at jobFinished(), you might be able to just use setMinimumLatency() when you do the builder, and set needsReschedule to true when your service has processed the job. That way it should only fire whenever your conditions are eventually met, and there'll be a minimum cooloff before the next one (assuming it works anyway, haven't tried it!)

Ehud
Sep 19, 2003

football.

I was given a project at work that involves readying 200 Galaxy S5 phones.

I need to accomplish the following:

- Load a couple of apps on each phone.

- Blow away all of the bloatware on each phone.

I started messing around with the Android SDK and I cannot find any way to do a batch disabling of apps without root access. Is that correct?

Doctor w-rw-rw-
Jun 24, 2008
https://source.android.com/devices/tech/admin/provision.html

Pakistani Brad Pitt
Nov 28, 2004

Not as taciturn, but still terribly powerful...



So we moved to a newer API version in order to add a major new feature to our app, and this bumped our minimum Android OS requirement from 4.1 to 4.4

The Play Store is now dealing dual APKs -- our desired newest one to anyone with 4.4 or higher, and the newest one that still supports the old API to users on 4.1 through 4.3. There aren't a ton of them of course, but we're running into a lot of bad reviews now as people on those older OS download the app, don't see the feature we're claiming on our website, and go "what gives?".

Is there any way to stop Google Play from delivering that old APK altogether? We'd rather people on less than 4.4 just saw "your device is not supported by this application" rather than get an old download that will never be bugfixed or have new features.

Tunga
May 7, 2004

Grimey Drawer

MrChupon posted:

Is there any way to stop Google Play from delivering that old APK altogether? We'd rather people on less than 4.4 just saw "your device is not supported by this application" rather than get an old download that will never be bugfixed or have new features.
Just go and unpublish the older APK.

Pakistani Brad Pitt
Nov 28, 2004

Not as taciturn, but still terribly powerful...



Tunga posted:

Just go and unpublish the older APK.

We were getting errors from the system when trying to do this, and I was in the middle of a big effort post about it until we got those errors resolved with a Google support person. My first positive interaction with Google support in any capacity of any of their products!

Anyway I just wanted to say thank you for responding to me, even if it was just to tell me to double down on the obvious. :-)

Tunga
May 7, 2004

Grimey Drawer

MrChupon posted:

Anyway I just wanted to say thank you for responding to me, even if it was just to tell me to double down on the obvious. :-)
Haha, I was running to a meeting as I posted that or I would have given more detail, glad you got it sorted.

uncle blog
Nov 18, 2012

I'm doing a school project in Android. An app that switches between fragments of different lists, some letting the user select a list item to go to a calendar.

On one of the lists, I want a horizontal bar at the bottom edge of the screen (below a scrollable list), that stays locked there no matter the screen size. Right now the bar changes position depending on the phone. I want the entire view to be locked to the edges of the screen, only the list being scrollable, but I don't know how to do that.

Also, how do I lock the entire app to vertical orientation?

uncle blog fucked around with this message at 08:05 on Oct 4, 2016

Tunga
May 7, 2004

Grimey Drawer
Depends on the overall layout, there are a few ways to do it. The easiest would be either to use a FrameLayout with gravity=bottom on the bottom child view or use a LinearLayout with weight=1 on the child ScrollView. If that doesn't give you enough detail maybe post your XML and someone can suggest the best approach.

Screen orientation can be locked per activity by adding android:screenOrientation="portrait" to your manifest.

speng31b
May 8, 2010

It's always weird trying to describe XML layouts with just text, but you'll probably want:

Outer vertical orientation linear layout, match parent in both directions...

Whose first child is your main list, let's say a recycler view. This should be set to layout height=0, layout weight=1, layout width=match parent...

Whose second child is your horizontal scroll view, height is a fixed amount (some number of dp).

As an extra thing to think about, consider the UX of how this pattern will scale on different screen sizes. I'm thinking not so good on phones without much vertical space; it's a good rule of thumb to make the entire vertical length of the screen scrollable rather than "fixing" pieces whenever possible. How can you do that here without losing information? Maybe introduce "scrollaway" behavior for your bottom horizontal scrollable area instead of keeping it fixed.

uncle blog
Nov 18, 2012

Thanks! That definitely improved things. Trouble now is that the bar gets pushed up the screen if the keyboard comes on screen, anyway to keep it locked behind it?

Here's the xml:
code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_marginBottom="0dp"
    android:layout_marginTop="0dp">

    <SearchView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:id="@+id/searchView" >

    </SearchView>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:background="@color/colorTitle">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:id="@+id/textView"
            android:text="Skoler i nærheten"
            android:layout_marginBottom="5dp"
            android:textAlignment="center"
            android:layout_gravity="center_horizontal"
            android:textColor="@color/colorBrightText" />
    </LinearLayout>


    <ListView
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:id="@+id/schoolsList"
        android:layout_centerHorizontal="true" />

    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:id="@+id/finished_container"
        android:gravity="center_vertical|center_horizontal"
        android:layout_marginBottom="0dp"
        android:layout_marginTop="0dp"
        android:layout_height="50dp"
        android:background="@color/colorClickable">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/finished"
            android:text="Ferdig"
            android:textSize="20dp" />

    </LinearLayout>

</LinearLayout>

Tunga
May 7, 2004

Grimey Drawer

uncle blog posted:

Thanks! That definitely improved things. Trouble now is that the bar gets pushed up the screen if the keyboard comes on screen, anyway to keep it locked behind it?
Set android:windowSoftInputMode to adjustPan for your activity in the manifest.

uncle blog
Nov 18, 2012

That did the trick! What I'm noticing now, is that if the list isn't large enough, it gets compacted and the bottom bar gets moved up, even though the outer layer is set to fill parent.

Tunga
May 7, 2004

Grimey Drawer
Don't use fill_parent, it's deprecated (because the name is confusing) and behaves identically to match_parent.

You have two LinearLayouts which only contain one TextView each, you can just put the TextView in directly (unless these are just placeholders for something more complicated, in which case ignore me).

You also shouldn't need those 0dp margins?

The ListView looks okay, I'd have to poke it to figure out what's up with that but at work currently. I'm not aware of any issues using layout_weight on a ListView.

You could also create the same thing with a RelativeLayout or FrameLayout.

speng31b
May 8, 2010

uncle blog posted:

That did the trick! What I'm noticing now, is that if the list isn't large enough, it gets compacted and the bottom bar gets moved up, even though the outer layer is set to fill parent.

If it's getting compacted upwards that has something to do with content below the outermost parent LinearLayout in whatever hierarchy that whole thing is in. The height of a layout_weight=1, layout_height=0 ListView inside a parent vertical linearlayout will always spread out to fill as much of the parent as it can, and it will have absolutely nothing to do with the content of the ListView itself. However, the outermost LinearLayout - even if it's set to match_parent - might not totally fill its parent if there's some other fixed-size content in the same parent. "match_parent" is a bit confusing, it doesn't mean "always match the parent in all cases", it really means "get as close to matching the parent as you can, but don't push away any sibling views of fixed sizes". Look for something programmatically changing your layout, or something like that ... it's not an xml problem - at least not with the xml you've shown us. There's some superfluous xml values in there but nothing dangerous that would be causing the issues you're seeing.

speng31b fucked around with this message at 18:46 on Oct 5, 2016

uncle blog
Nov 18, 2012

Thanks again guys, I'll keep tinkering with it.

Do you happen to know if it's possible to set a handler for when the keyboard is dismissed (when the user hides the keyboard with the down-arrow on the Android bar)? Google only gave me tips on how to hide the keyboard.

Tunga
May 7, 2004

Grimey Drawer

uncle blog posted:

Thanks again guys, I'll keep tinkering with it.

Do you happen to know if it's possible to set a handler for when the keyboard is dismissed (when the user hides the keyboard with the down-arrow on the Android bar)? Google only gave me tips on how to hide the keyboard.
There are a few ways of doing it and none of them work reliably 100% of the time. You can listen for focus changes on the text box, listen for activity/fragment re-layouts if you use adjustresize rather than adjustpan, and some others I forget now.

Basically you should avoid doing this wherever possible.

Consider also that some devices have hardware keyboards so the keyboard is always "available". This is why it's not as simple as you might imagine.

speng31b
May 8, 2010

Tunga posted:

There are a few ways of doing it and none of them work reliably 100% of the time. You can listen for focus changes on the text box, listen for activity/fragment re-layouts if you use adjustresize rather than adjustpan, and some others I forget now.

Basically you should avoid doing this wherever possible.

Consider also that some devices have hardware keyboards so the keyboard is always "available". This is why it's not as simple as you might imagine.

If you really need to do this, you'll want to check for your window insets changing by an appropriate amount (100px worked for me in an app with ~2mil users and a crapton of QA time, but in retrospect should probably define something in DP instead). At the time I used fitSystemWindows with all the appropriate setup. Looks like that's deprecated now.

But yeah, really just try to find a way to not do this...

speng31b fucked around with this message at 00:21 on Oct 6, 2016

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

The better question is why do you want to do it? There might be an easier way to achieve whatever you're up to without trying to watch what the soft keyboard is doing

Also they actually fixed the android docs site so it's readable on a phone :eyepop::eyepop::eyepop:

Adbot
ADBOT LOVES YOU

uncle blog
Nov 18, 2012

The page is a list of several items, with a search bar above it. If the user enters the search and starts typing, the list gets replaced by the results of the search. I want the original list to reappear when the user exits the search bar, and thought dismissing the keyboard seemed like a good point of reference.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply